package com.hefei.hight;

import java.util.Calendar;
import java.util.Date;

/**
 * @author caizhengjun
 * @date 2020/9/4 8:56 下午
 */
public class Test05 {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        Date time = calendar.getTime();
        System.out.println(time);

        Date date = new Date();
        calendar.setTime(date);

        System.out.println(calendar.getTime());

        calendar.set(Calendar.DAY_OF_MONTH, 8);

        System.out.println(calendar.getTime());

        calendar.add(Calendar.HOUR, 2);

        System.out.println(calendar.getTime());

        calendar.add(Calendar.MONTH, -2);

        System.out.println(calendar.getTime());

    }
}
